<?php
namespace app\admin\validate;

use think\Validate;

class AdminUser extends Validate
{
    //验证规则
    protected $rule = [
        ['user_name', 'require', '请输入用户名'],
        ['password', 'require', '请输入用户密码'],
        ['group_id', 'require', '请选择用户角色'],
        ['captcha', 'require|captcha', '请输入验证码|验证码错误']
    ];

    //验证场景
    protected $scene = [
        'login' => ['user_name', 'password', 'captcha'],
        'add' => ['user_name', 'password', 'group_id'],
        'edit' => ['user_name', 'group_id']
    ];

}